//
//  SEFollowedViewController.swift
//  SmartEyeForPatient
//
//  Created by QDSG on 2021/4/17.
//

import UIKit
import DNSPageView

class SEFollowedViewController: SEBaseViewController {
    
    override func setupUI() {
        super.setupUI()
        
        view.addSubview(pageViewManager.titleView)
        pageViewManager.titleView.snp.makeConstraints { (make) in
            make.left.right.equalToSuperview()
            make.top.equalToSuperview().offset(UIScreen.navigationBarMaxY)
            make.height.equalTo(45)
        }

        view.addSubview(pageViewManager.contentView)
        pageViewManager.contentView.snp.makeConstraints { (make) in
            make.top.equalTo(pageViewManager.titleView.snp.bottom).offset(1)
            make.left.right.bottom.equalToSuperview().priority(.low)
            make.bottom.equalTo(-UIScreen.bottomSafeHeight)
        }
    }

    private lazy var pageViewManager: PageViewManager = {
        let style = PageStyle()
        style.isShowBottomLine = true
        style.isTitleScaleEnabled = true
        style.titleFont = UIFont.medium(14)
        style.titleColor = Asset.textDark.color
        style.titleSelectedColor = Asset.main.color
        style.bottomLineColor = Asset.main.color
        style.bottomLineWidth = 50
        style.bottomLineRadius = 2
        
        let titles = ["医生", "医院"]
        
        for title in titles {
            if title == "医生" {
                let controller = SEFollowedDoctorsViewController()
                addChild(controller)
            } else {
                let controller = SEFollowedHospitalsViewController()
                addChild(controller)
            }
        }

        return PageViewManager(style: style, titles: titles, childViewControllers: children)
    }()

}
